import 'package:camera_product_plugin/camera_product_plugin.dart';
import 'package:camera_product_plugin/camera_product_plugin_method_channel.dart';
import 'package:camera_product_plugin/camera_product_plugin_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockCameraProductPluginPlatform
    with MockPlatformInterfaceMixin
    implements CameraProductPluginPlatform {
  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<String?> initCameraSDK() => Future.value("initCameraSDK");

  @override
  Future<String?> scanBluetooth() => Future.value("scanBluetooth");

  @override
  Future<String?> connectBluetooth(String deviceJson) =>
      Future.value("connectBluetooth");

  @override
  Future<String?> scanWIFI() => Future.value("scanWIFI");

  @override
  Future<String?> connectWIFI(String wifiJson) => Future.value("connectWIFI");

  @override
  Future<String?> takePhoto() => Future.value("takePhoto");

  @override
  Future<String?> removeCameraListener() => Future.value("removeCameraListener");

  @override
  Future<String?> disConnectBluetooth() => Future.value("disConnectBluetooth");

  @override
  void onListening(void Function(dynamic event) onData) {
    print("======onListening======");
  }
}

void main() {
  final CameraProductPluginPlatform initialPlatform =
      CameraProductPluginPlatform.instance;

  test('$MethodChannelCameraProductPlugin is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelCameraProductPlugin>());
  });

  test('getPlatformVersion', () async {
    CameraProductPlugin cameraProductPlugin = CameraProductPlugin();
    MockCameraProductPluginPlatform fakePlatform =
        MockCameraProductPluginPlatform();
    CameraProductPluginPlatform.instance = fakePlatform;

    expect(await cameraProductPlugin.getPlatformVersion(), '42');
  });
}
